<?php
/**
 * Created by PhpStorm.
 * User: *!N.J
 * Date: 2021/9/1
 * Time: 23:17
 * QQ:1467572213
 */

namespace app\agent\controller;

use think\facade\Request;
use think\facade\Session;
use \app\agent\model\Count as Count_m;

class Count extends Base
{
    public function statistics()
    {
        $agent_id = Session::get('agent_id');
        $start_time = Request::get('start_time', date('Y-m-d'));
        $end_time = Request::get('end_time', date('Y-m-d'));
        $this->assign('start_time', $start_time);
        $this->assign('end_time', $end_time);
        $dec_time = date("Y-m-d", strtotime("-1 day", strtotime("$start_time")));
        $inc_time = date("Y-m-d", strtotime("+1 day", strtotime("$start_time")));
        $this->assign('dec_time', $dec_time);
        $this->assign('inc_time', $inc_time);
        $pid_name = Request::get('pid_name');
        $info = Count_m::statistics($agent_id,$start_time,$end_time,$pid_name);
        $this->assign('info',$info);
        return $this->fetch();
    }

    public function report()
    {
        return $this->fetch();
    }

}